{block name="main"}
        <!-- page -->
		<div class="mb-20">
            <div class="input-group search-input-group ml-10" style="float:right">
                <input type="text" class="form-control" placeholder="手机号码" id="search_text" value="">
                <span class="input-group-btn">
                    <button id="search" class="btn btn-primary" type="button">搜索</button>
                </span>
            </div>
            <div style="clear:both;"></div>
        </div>
        <table class="table v-table table-auto-center">
            <thead>
            <tr>
                <th>会员</th>
                <th>签到时间</th>
                <th>奖品类型</th>
                <th>签到奖励</th>
            </tr>
            </thead>
            <tbody id="sign_in_list">
            </tbody>
        </table>
        <input type="hidden" id="page_index">
        <nav aria-label="Page navigation" class="clearfix">
            <ul id="page" class="pagination pull-right"></ul>
        </nav>

        <!-- page end -->
{/block}
{block name="script"}
<script id="tpl_list" type="text/html">
    <%each data as item index%>
    <tr>
        <td><%item.user_tel%></td>
        <td><span><%timeStamp(item.sign_in_time)%></span></td>
        <td><%item.type%></td>
        <td><%item.type_name%></td>
    </tr>
    <%/each%>
</script>

<script>
    require(['util', 'tpl'], function (util, tpl) {
        util.initPage(LoadingInfo);
        tpl.helper("timeStamp", function (timeStamp) {
            if (timeStamp > 0) {
                var date = new Date();
                date.setTime(timeStamp * 1000);
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                m = m < 10 ? ('0' + m) : m;
                var d = date.getDate();
                d = d < 10 ? ('0' + d) : d;
                var h = date.getHours();
                h = h < 10 ? ('0' + h) : h;
                var minute = date.getMinutes();
                var second = date.getSeconds();
                minute = minute < 10 ? ('0' + minute) : minute;
                second = second < 10 ? ('0' + second) : second;
                return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
            } else {
                return "";
            }
        });

        function LoadingInfo(page_index) {
            $("#page_index").val(page_index);
            $.ajax({
                type: "post",
                url: "{$signinListUrl}",
                data: {
                    "page_index": page_index,
                    "search_text": $("#search_text").val(),
                    "state": $("#state").val(),
                },
                success: function (data) {
                    html ='';
                    html += '<tr><td class="h-200" colspan="4">暂无符合条件的数据记录</td></tr>';
                    if(tpl('tpl_list', data)){
                        $("#sign_in_list").html(tpl('tpl_list', data));
                        $('#page').paginator('option', {
                            totalCounts: data['total_count']  // 动态修改总数
                        });
                    }else{
                        $("#sign_in_list").html(html);
                    }
                }
            });
        }
        
        $("#search").on('click', function () {
        	LoadingInfo(1);
        }); 
    })
</script>
{/block}
